var ewm = document.getElementsByClassName("icon-erweima")[0];
var sfz = document.getElementsByClassName("icon-shenfenzheng")[0];
var dian = document.getElementsByClassName("id-swidch")[0];
var dewm = document.getElementsByClassName("id-box")[0];
var deng = document.getElementsByClassName("id-login")[0];
var mask = document.getElementsByClassName("id-mask")[0];
console.log(dian);
var flag = 1;
dian.onclick = function () {
    if (flag == 1) {
        ewm.style.display = 'none';
        sfz.style.display = 'block';
        deng.style.display = 'none';
        dewm.style.display = 'block';
        flag = 0;
    } else if (flag == 0) {
        ewm.style.display = 'block';
        sfz.style.display = 'none';
        deng.style.display = 'block';
        dewm.style.display = 'none';
        flag = 1;
    }
    if (flag == 0) {
        var timeId1 = setTimeout(function () {
        mask.style.display = 'block';
        }, 20000)
    } else if (flag == 1) {
        clearTimeout(timeId1);
    }
};
var username1 = document.getElementsByClassName('username1')[0];
// console.log(username);
var username2 = document.getElementsByClassName('username2')[0];
var username3 = document.getElementsByClassName('username3')[0];
var cuo = document.getElementsByClassName("id-msg-warp")[0];
var btn = document.getElementsByClassName("id-btn")[0];
var reg = /^[a-zA-Z0-9_]{5,20}$/;
var reg2 =  /^[a-zA-Z0-9_-]{6,16}$/;
username1.onblur = function() {
    if (reg.test(this.value)) {
        cuo.innerText = '用户名输入正确';
        cuo.style.color = "green";
    } else {
        cuo.innerText = '请输入正确的用户名';
        cuo.style.color = "red";
    }
};
username2.onblur = function() {
    if (reg2.test(this.value)) {
        cuo.innerText = '密码输入正确';
        cuo.style.color = "green";
    } else {
        cuo.innerText = '请输入正确的用户名';
        cuo.style.color = "red";
    }
};
username3.onblur = function() {
    if (reg.test(this.value)) {
        cuo.innerText = '验证码输入正确';
        cuo.style.color = "green";
    } else {
        cuo.innerText = '请输入正确的用户名';
        cuo.style.color = "red";
    }
};

